home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / mklib-emx.cmd < prev    next >
OS/2 REXX Batch file  |  1998-12-15  |  2KB  |  107 lines

  1. /* mklib-emx.cmd */
  2.  
  3. version = "19980802"
  4.  
  5. TRUE=1
  6. FALSE=0
  7. quiet = TRUE
  8. /* DEBUG = TRUE */
  9. DEBUG = FALSE
  10.  
  11. Parse Arg param Major Minor Objects
  12.  
  13. say "mklib-emx version "version
  14.  
  15. Parse Var param base '.' extension
  16. _extension=Strip(Translate(extension))
  17.  
  18. select
  19.   when _extension = "" then
  20.     do
  21.     DynaLibrary = Base".dll"
  22.     StatLibrary = Base".a"
  23.     end
  24.   when _extension = "A" then
  25.     do
  26.     DynaLibrary = Base".dll"
  27.     StatLibrary = Base".a"
  28.     end
  29.   when _extension = "LIB" then
  30.     do
  31.     DynaLibrary = Base".dll"
  32.     StatLibrary = Base".lib"
  33.     end
  34.   otherwise
  35.     do
  36.     say 'error. unknown extension'
  37.     exit
  38.     end
  39.   end /* select */
  40.  
  41. if DEBUG then
  42.   do
  43.   say "DynaLibrary: "DynaLibrary
  44.   say "StatLibrary: "StatLibrary
  45.   Say "Major: "Major
  46.   Say "Minor: "Minor
  47.   Say "Objects: "Objects
  48.   end
  49.  
  50. DEFFile = Base".def"
  51. olddef = Stream(DEFFile, 'C', 'QUERY EXISTS')
  52. if olddef <> "" then
  53.   do
  54.   tmpfile = SysTempFileName('.\mklib-emx.???')
  55.   call ExecCmd("mv "olddef" "tmpfile)
  56.   say "Renaming old "DEFFile" to "tmpfile
  57.   end
  58.  
  59. call LineOut DEFFile ,,1
  60. call LineOut DEFFile,  'LIBRARY "'Base'"'
  61. call LineOut DEFFile,  'DESCRIPTION "X11R6 Xfree86 'DynaLibrary' for OS/2 EMX09c VERSION=1.2.7"'
  62. call LineOut DEFFile,  'CODE'
  63. call LineOut DEFFile,  '   PRELOAD'
  64. call LineOut DEFFile,  'DATA'
  65. call LineOut DEFFile,  '   MULTIPLE NONSHARED'
  66. call LineOut DEFFile,  'STACKSIZE 65536'
  67. call LineOut DEFFile,  'EXPORTS'
  68.  
  69. call LineOut DEFFile 
  70.  
  71. call CreateSymbolList
  72.  
  73. DLLFLAGS = "-Zdll -Zmt -Zcrtdll"
  74. DLLLibs = "-lXi -lXmu -lXext -lXt -lX11 -lSM -lICE"
  75.  
  76. if Translate(Base) = "MESAGL" then
  77.   DLLGLLIBS = ""
  78. if Translate(Base) = "MESAGLU" then
  79.   DLLGLLIBS = "-L..\lib -lMesaGL"
  80. if Translate(Base) = "GLUT" then
  81.   DLLGLLIBS = "-L..\lib -lMesaGL -lMesaGLU"
  82.  
  83. call ExecCmd("gcc -o "DynaLibrary" "DLLFLAGS" "Objects" "DEFFile" "DLLGLLIBS" "DLLLibs)
  84.  
  85. call ExecCmd("emximp -o "StatLibrary" "DEFFile)
  86.  
  87. call ExecCmd("mv "DynaLibrary" ..\lib")
  88. call ExecCmd("cp "Base".def ..\lib")
  89.  
  90. exit
  91.  
  92. /* Small procedures */
  93.  
  94. CreateSymbolList:
  95. Olist = Objects
  96. call ExecCmd("emxexp "OList" >>"DEFFile)
  97. return
  98.  
  99. ExecCmd: PROCEDURE EXPOSE quiet
  100. /* Execute a command properly and return it's return value */
  101. Parse Arg cmdstring
  102. if quiet then
  103.   Address CMD "@ "cmdstring
  104. else
  105.   Address CMD cmdstring
  106. return rc
  107.